# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=radvd
pkgver=2.18
pkgrel=0
pkgdesc="IPv6 router advertisement daemon"
url="http://www.litech.org/radvd"
arch="all"
license="BSD with advertising"
depends=""
makedepends="flex bison libdaemon-dev linux-headers check-dev"
checkdepends=""
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-openrc"
source="http://www.litech.org/radvd/dist/radvd-$pkgver.tar.xz
	radvd.initd
	radvd.confd
	"
builddir="$srcdir/$pkgname-$pkgver"

# test failure on builders due to kernel issue
case "$CARCH" in
mips*)	options="!check";;
esac

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc/ \
		--with-check \
		--with-pidfile=/run/radvd/radvd.pid
	# work around parallel build issue
	make gram.h && make
}

check() {
	make -C "$builddir" check
}

package() {
	cd "$builddir"
	make -j1 DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/radvd.initd "$pkgdir"/etc/init.d/radvd
	install -Dm644 "$srcdir"/radvd.confd "$pkgdir"/etc/conf.d/radvd
	install -Dm644 radvd.conf.example \
		"$pkgdir"/usr/share/doc/radvd/radvd.conf.example
}

sha512sums="f45a600d63a93fc58cc3d1c33545ed641337a82281dbeca2f98a9fee224d38e7c547c1624e02682df007e0215b39b5756f60093bae9264d54e4b388f89b6d108  radvd-2.18.tar.xz
5f96261f3914ff10966828231d1c8df0d7b0e432d5e075eb6405f923a25f1218e647ec8a2c5b7fa995cf44cc521fd226b4bacfe86920d108130852f00623d8c5  radvd.initd
386a6cdee43a0aa157760a590b9daa52e06e2c344a8d191a188c6174281734df95b82121e92d3c01e6c0fe76658dbdf6467dee2b30e2e010fc57dc8e0666b2cc  radvd.confd"
